//
//  sanFanYuanController.m
//  sanFsports
//
//  Created by mac on 16/11/20.
//  Copyright © 2016年 sanAiFuSport.com. All rights reserved.
//

#import "sanFanYuanController.h"
#import "Masonry.h"
#import "sanHomeTopView.h"
#import "sanFunctionView.h"
#import "SanCategoryTableViewCell.h"

#import "sanDateViewController.h"
#import "sanQuYuViewController.h"
#import "sanMapViewController.h"
#import "sanSeQuViewController.h"
#import "MSSCalendarViewController.h"
#define kHeaderHeight 64
static NSString *sanCell = @"sanCell";

@interface sanFanYuanController ()<UITableViewDelegate,UITableViewDataSource,sanHomeTopViewDelegate>

@property (nonatomic,assign)NSInteger startDate;// 选中开始时间
@property (nonatomic,assign)NSInteger endDate;// 选中结束时间

@end

@implementation sanFanYuanController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"雪场房源";
    self.view.backgroundColor = [UIColor yellowColor];
    [self setupUI];

}
#pragma mark-- 搭建界面
- (void)setupUI
{
    //顶部视图
    UIView *headerV = [[UIView alloc]init];
    headerV.backgroundColor = [UIColor redColor];
    
    [self.view addSubview:headerV];
    
    [headerV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.equalTo(self.view);
        
        make.height.mas_equalTo(kHeaderHeight);
    }];
    
    sanHomeTopView *topView = [[sanHomeTopView alloc]init];
    topView.backgroundColor = [UIColor lightGrayColor];
    
    [topView setModalBlock:^(NSInteger tagType) {

        switch (tagType) {
            case 1: {
                
//                MSSCalendarViewController *cvc = [[MSSCalendarViewController alloc]init];
//                cvc.limitMonth = 12 * 15;// 显示几个月的日历
//                /*
//                 MSSCalendarViewControllerLastType 只显示当前月之前
//                 MSSCalendarViewControllerMiddleType 前后各显示一半
//                 MSSCalendarViewControllerNextType 只显示当前月之后
//                 */
//                
//                cvc.type = MSSCalendarViewControllerMiddleType;
//                cvc.beforeTodayCanTouch = YES;// 今天之后的日期是否可以点击
//                cvc.afterTodayCanTouch = YES;// 今天之前的日期是否可以点击
//                cvc.startDate = _startDate;// 选中开始时间
//                cvc.endDate = _endDate;// 选中结束时间
//                /*以下两个属性设为YES,计算中国农历非常耗性能（在5s加载15年以内的数据没有影响）*/
//                cvc.showChineseHoliday = YES;// 是否展示农历节日
//                cvc.showChineseCalendar = YES;// 是否展示农历
//                cvc.showHolidayDifferentColor = YES;// 节假日是否显示不同的颜色
//                cvc.showAlertView = NO;// 是否显示提示弹窗
//                cvc.delegate = self;
                sanDateViewController *cvc = [sanDateViewController new];
                [self presentViewController:cvc animated:YES completion:nil];
                
                break;
            }
            case 2: {
                
                sanQuYuViewController *vc = [sanQuYuViewController new];
                
                [self presentViewController:vc animated:YES completion:nil];

                break;
            }
            case 3: {
                
                sanMapViewController *vc = [sanMapViewController new];
                
                [self presentViewController:vc animated:YES completion:nil];
                
                break;
            }
            case 4: {
                
                sanSeQuViewController *vc = [sanSeQuViewController new];
                
            [self presentViewController:vc animated:YES completion:nil];
                
                break;
            }
                
            default:
                break;
        }
    }];
    topView.delegate = self;
    [self.view addSubview:topView];
    
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(headerV.mas_bottom);
        make.left.right.equalTo(headerV);
        make.height.mas_equalTo(40);
    }];
    
    sanFunctionView *fuc = [[sanFunctionView alloc]init];
    [self.view addSubview:fuc];
    
    [fuc mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self.view);
        make.top.equalTo(topView.mas_bottom);
    }];
    
    fuc.rowHeight = 325;
    fuc.dataSource = self;
    [fuc registerNib:[UINib nibWithNibName:@"SanCategoryView" bundle:nil] forCellReuseIdentifier:sanCell];
    
}

#pragma mark-- 实现数据源方法

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 20;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    SanCategoryTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:sanCell forIndexPath:indexPath];
    
    return cell;
}


@end
